home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1997 / MacHack 1997.toast / Hacks / Hacks ’97 / Warrior’s Progress / source code / Source / Libraries / Buffers / BufferOf.cp < prev    next >
Encoding:
Text File  |  1997-06-28  |  815 b   |  42 lines  |  [TEXT/CWIE]

  1. // BufferOf.cp
  2.  
  3. #ifndef BufferOf_h
  4. #include "BufferOf.h"
  5. #endif
  6. #ifndef ConstBufferOf_h
  7. #include "ConstBufferOf.h"
  8. #endif
  9.  
  10. template < class Element >
  11. BufferOf<Element>::BufferOf( ArrayType theSpace )
  12.   : space( theSpace ),
  13.      mark( 0 )
  14.   {
  15.     Assert( !theSpace.Null() );
  16.   }
  17.  
  18. template < class Element >
  19. void BufferOf<Element>::Reset( ArrayType theSpace )
  20.   {
  21.     Assert( !theSpace.Null() );
  22.     space = theSpace;
  23.     mark = 0;
  24.   }
  25.  
  26. template < class Element >
  27. void BufferOf<Element>::operator<<( ConstArrayType toWrite )
  28.   {
  29.     Assert( toWrite.Length() <= UnusedLength() );
  30.     mark += Unused() << toWrite;
  31.   }
  32.  
  33. template < class Element >
  34. void BufferOf<Element>::operator<<( ConstBufferType& source )
  35.   {
  36.     uint32 amount = Unused() << source.Unused();
  37.     AdvanceMark( amount );
  38.     source.AdvanceMark( amount );
  39.   }
  40.  
  41. #include "ArrayOf.cp"
  42.